Skip to content

Fix runString temp path to use tmpdir() and add regression test#320

Open
dusan-maintains wants to merge 1 commit intoextrabacon:masterfrom
dusan-maintains:maintenance/fix-runstring-temp-path
Open

Fix runString temp path to use tmpdir() and add regression test#320
dusan-maintains wants to merge 1 commit intoextrabacon:masterfrom
dusan-maintains:maintenance/fix-runstring-temp-path

Conversation

@dusan-maintains
Copy link

Summary

  • Fix PythonShell.runString() temp file path generation by calling tmpdir() instead of using the function reference.
  • Add a focused unit test that validates temp-file creation in OS temp dir and verifies handoff to PythonShell.run without spawning Python.

Why

  • Current code builds filePath with tmpdir + sep + ..., which uses the function object instead of the temp directory path.
  • This can produce invalid or non-existent paths for writeFileSync, making runString() fragile.

Test Plan

  • npm test -- --grep "temporary file in the OS temp directory"
    • Result in this environment: 1 passing.

Compatibility

  • No API changes.
  • Existing behavior is preserved; this only fixes temp-path construction and adds regression coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant