Skip to content

Nushell no longer provides environment for "start" command in windows #8551

@geniusisme

Description

@geniusisme

Describe the bug

Program started by "start" command does not have environment set by nushell.

How to reproduce

D:\code\start-env〉let-env MY_VAR = 'value'  
D:\code\start-env〉start a.my_extension 
  1. In popup, select assosiated application (see below)
  2. Observe output:
    no var

Expected behavior

D:\code\start-env〉let-env MY_VAR = 'value'
D:\code\start-env〉start a.my_extension 
  1. In popup, select assosiated application (see below)
  2. Observe output:
    var was: value

Screenshots

No response

Configuration

D:\code\start-env〉version | transpose key value | to md --pretty 03/21/2023 04:14:12 PM

key value
version 0.77.0
branch
commit_hash
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.65.0 (897e37553 2022-11-02)
rust_channel stable-x86_64-pc-windows-msvc
cargo_version cargo 1.65.0 (4bc8f24d3 2022-10-20)
build_time 2023-03-16 08:32:18 +01:00
build_rust_channel release
features default, zip
installed_plugins

Additional context

Simple rust program reading environment:

use std::env;
use std::io;
use std::io::prelude::*;

fn main() {

    match env::var("MY_VAR") {
        Ok(var) => println!("var was: {}", var),
        Err(_) => println!("no var"),
    }

    let stdin = io::stdin();
    for line in stdin.lock().lines() {
        println!("echo {}", line.unwrap());
    }
}

Environment was passed correctly in nushell 0.72. I encountered the bug when upgraded to 0.77, not sure which intermediate version is to blame.

Additionally, one can run following in cmd to observe correct behavior:

D:\code\start-env>set MY_VAR=value

D:\code\start-env>a.my_extension
var was: value

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions