Use OS temp dir in runString - #330
Conversation
Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
|
I checked this locally on Windows. Validated:
The fix looks correct to me: I could not use the full |
PNHD
left a comment
There was a problem hiding this comment.
Reviewed current head fc0422d.
This is the focused form of the runString() temp-path fix: it preserves the existing collision-resistant random suffix, changes only the broken tmpdir function reference to join(tmpdir(), ...), and the regression verifies the generated file location/content plus option forwarding without needing to spawn Python.
I prefer this scoped PR over the overlapping change in #322. LGTM.
Refreshes stale PR #320 with the same minimal fix and focused coverage.
PythonShell.runString()currently builds its temp file path with the importedtmpdirfunction reference instead of callingtmpdir(). That can produce an invalid path beforePythonShell.run()is reached.This change uses
path.join(tmpdir(), ...)and adds a regression test that interceptsPythonShell.run()to verify:Verification:
npm run compileOnce && npx mocha -r ts-node/register --grep "runString"npm testnpx prettier --check index.ts test/test-python-shell.tsgit diff --check