Driky
Driky

Reputation: 297

Process.run: ProcessException: The system cannot find the file specified

I'm trying to fix a library that doesn't work (for me) on latest dart version.

Right now the problems I'm facing comes from the following line in a test setup:

Process.runSync('pub', ['get'], workingDirectory: stubPath);

which errors out as:

ProcessException: The system cannot find the file specified.

  Command: pub get

dart:io                             Process.runSync
test\test_coverage_test.dart 32:15  main.<fn>.<fn>

The pub executable is on my path and works well when run manually from a shell. I checked and the dart process does receive the environment properly (PATH is set).

I'm working on windows 10, and tried running the test in both powershell and cmd and even in administrator.

The library worked well before upgrading from Dart 2.9.x to 2.12.1

Upvotes: 3

Views: 1657

Answers (1)

Alex
Alex

Reputation: 2364

I was having the same issue and I fixed passing the runInShell: true argument:

await Process.runSync('pub', ['get'], workingDirectory: yourWorkingDir, runInShell: true);

Upvotes: 6

Related Questions