Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ shiny-server 1.5.20
then deploy the generated index.html, index_files directory, and the source
index.qmd together to be served by Shiny Server.

* Fix spurious log warning about "--preserve-environment" in app logs.

* Upgrade Node.js to 16.18.1.

shiny-server 1.5.19
Expand Down
2 changes: 1 addition & 1 deletion lib/worker/app-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ function createPyShinySpawnSpec(appSpec, endpoint, workerId, logFile, home) {
function wrapWithUserSwitch(spec, user) {
var command = "su";
var args = [
"-p",
"--",
user,
"-c",
Expand All @@ -614,6 +613,7 @@ function wrapWithUserSwitch(spec, user) {
}
else {
// Other platforms don't clear out env vars, so simulate user env
args.unshift("-p");
args.unshift("-");
}
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/worker/app-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ async function createPyShinySpawnSpec(
function wrapWithUserSwitch(spec: SpawnSpec, user: string): SpawnSpec {
const command = "su";
let args = [
"-p",
"--",
user,
"-c",
Expand All @@ -664,6 +663,7 @@ function wrapWithUserSwitch(spec: SpawnSpec, user: string): SpawnSpec {
args = ["-s", "/bin/bash", "--login"].concat(args);
} else {
// Other platforms don't clear out env vars, so simulate user env
args.unshift("-p");
args.unshift("-");
}

Expand Down
25 changes: 13 additions & 12 deletions test/app-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,22 @@ async function testLaunchWorker_p(
// that there's a window of time where $proc isn't populated)
await poll(() => !!worker.$proc);

// Ensure that calls to child_process.spawn() were exactly as expected
assert(mock_spawn.callCount == (appSpec.settings.logAsUser ? 2 : 1));
if (appSpec.settings.logAsUser) {
try {
// Ensure that calls to child_process.spawn() were exactly as expected
assert(mock_spawn.callCount == (appSpec.settings.logAsUser ? 2 : 1));
if (appSpec.settings.logAsUser) {
assert.deepStrictEqual(
mock_spawn.firstCall.args,
expectedSpawnLogParams(logFilePath, pw)
);
}
assert.deepStrictEqual(
mock_spawn.firstCall.args,
expectedSpawnLogParams(logFilePath, pw)
mock_spawn.lastCall.args,
expectedSpawnRParams(appSpec, pw)
);
} finally {
worker.$proc.kill();
}
assert.deepStrictEqual(
mock_spawn.lastCall.args,
expectedSpawnRParams(appSpec, pw)
);

worker.$proc.kill();

assert.deepEqual(await worker.getExit_p(), {
code: null,
Expand Down Expand Up @@ -299,7 +301,6 @@ function expectedSpawnRParams(appSpec, pw) {
"su",
[
...startArgs,
"-p",
"--",
appSpec.runAs,
"-c",
Expand Down