Skip to content

Commit e7e5d55

Browse files
authored
Fix issue starting R/Python when /bin/sh is user's shell (#7881)
This change addresses an issue in which starting R/Python sessions fails when `/bin/sh` is the user's default shell. Vanilla `sh` does not support the long form `--login` flag, only `-l` to run login scripts. Thankfully bash-alikes support `-l` as an alias to `--login` too, so we can support both with `-l`. (realize that there are a long tail of other shells we can probably test with like `fish`, `csh`/`tcsh`, etc; the intent of this fix is to just cover the most common shells for now, which is `bash`, `zsh`, and `sh`) Addresses #7874. ### QA Notes - See the original issue for instructions on changing your shell to `/bin/sh` to test this. - Before verifying the issue, I recommend running `echo $SHELL` in a Terminal to verify that you are really using `sh` as a shell.
1 parent 8f39a54 commit e7e5d55

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

extensions/positron-supervisor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
},
151151
"positron": {
152152
"binaryDependencies": {
153-
"kallichore": "0.1.41"
153+
"kallichore": "0.1.42"
154154
}
155155
},
156156
"extensionDependencies": [

extensions/positron-supervisor/resources/supervisor-wrapper.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if [ -z "$DEFAULT_SHELL" ] || [ ! -x "$DEFAULT_SHELL" ]; then
5555
fi
5656

5757
# Print the command line to the log file
58-
echo "$DEFAULT_SHELL" --login -c "$@" >> "$output_file"
58+
echo "$DEFAULT_SHELL" -l -c "$@" >> "$output_file"
5959

6060
# Quote the arguments to handle single quotes and spaces correctly
6161
QUOTED_ARGS=""
@@ -69,11 +69,11 @@ done
6969
# Run the program with its arguments, redirecting stdout and stderr to the output file
7070
if [ "$use_nohup" = true ]; then
7171
# Use nohup and explicitly redirect its output to prevent nohup.out from being created
72-
nohup $DEFAULT_SHELL --login -c "${QUOTED_ARGS}" >> "$output_file" 2>&1 &
72+
nohup $DEFAULT_SHELL -l -c "${QUOTED_ARGS}" >> "$output_file" 2>&1 &
7373
# Wait for the background process to complete
7474
wait $!
7575
else
76-
$DEFAULT_SHELL --login -c "${QUOTED_ARGS}" >> "$output_file" 2>&1
76+
$DEFAULT_SHELL -l -c "${QUOTED_ARGS}" >> "$output_file" 2>&1
7777
fi
7878

7979
# Save the exit code of the program

0 commit comments

Comments
 (0)