fix(cli-test): invoke commands without shell intermediate#2582
Conversation
…iner hangs In Windows Server Docker containers, processes hang when they inherit Docker's entrypoint pipe handles. Using cmd.exe (via shell:true or the explicit /s /c wrapper) triggers this issue. This change spawns the CLI binary directly on Windows with shell:false. Also simplifies escapeJSON in datastore commands since outer quote wrapping is no longer needed without cmd.exe consuming them. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
🦋 Changeset detectedLatest commit: 67559ab The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2582 +/- ##
==========================================
+ Coverage 87.50% 87.52% +0.02%
==========================================
Files 62 62
Lines 10256 10228 -28
Branches 418 418
==========================================
- Hits 8974 8952 -22
+ Misses 1260 1254 -6
Partials 22 22
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
The generic env parameter tests hardcoded shell:true but on Windows it's now shell:false. Use process.platform to set the expected value. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Using shell:true causes issues with special characters like # being interpreted as comments. Spawning the CLI binary directly with shell:false avoids both the Windows Docker hang and the need for outer-quote hacks to protect shell metacharacters. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
- Remove redundant platform if-branch in getSpawnArguments (both paths were identical after shell:false change) - Inline escapeJSON as JSON.stringify at call sites - Inline expectedShell constant directly in test assertions Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
|
🔮 🚀 Will make an RC from this branch for testing purposes! |
The Go CLI flag parser fails to receive values starting with # (like #/workflows/give_kudos_workflow) when passed as direct argv entries via shell:false on Linux. Reverting to shell:true on non-Windows with single-quote escaping for each argument protects special characters. Windows retains shell:false to avoid Docker pipe handle inheritance hangs. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
shell:false passes args directly to the process without any shell interpretation. This is simpler and avoids the need for quoting special characters like #. The original shell:true + cmd.exe workaround was only needed because child_process strips quotes when using a shell. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
left a comment
There was a problem hiding this comment.
👾 Another quick blurb if that's alright?
Co-authored-by: Eden Zimbelman <zim@o526.net>
|
🚢 Let's get this merged now for improvements to what we can test! I'll merge this now! |
Summary
This PR changes how the
slackprocess is spawned. Commands were routed through a shell either/bin/shor ascmd.exe /s /cbefore invoking the provided command. Nowslackcommands are invoked direct.This fixes:
cmd.exe /s /cwrapper on Windows requiredescapeJSONto add outer quotes that cmd.exe would strip. Withshell: false,JSON.stringifyvalues pass through unchanged.shell: trueon Linux causes#to be treated as a comment character, breaking values like#/workflows/give_kudos_workflow.Preview
Behind the scenes, this is what happens when spawning a command:
Linux:
Windows:
Notes
📚 Reference: https://nodejs.org/api/child_process.html#child-processspawnsynccommand-args-options
Requirements