tekartik / process_run.dart

Process run helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quotation marks are filtered out

xuqiqiang opened this issue · comments

I cannot run this command:
ffmpeg.exe -vf scale='min(250,iw)':-1 ...

When there are ' or " in an argument, the solution is to wrap the argument with shellArgument as it will properly format the parameter:

import 'package:process_run/shell.dart';

void main(List<String> arguments) async {
  // Incorrect
  await run("echo scale='min(250,iw)':-1");
  // Correct
  await run('echo ${shellArgument("scale='min(250,iw)':-1")}');
}

should give:

$ echo scale=min(250,iw):-1
scale=min(250,iw):-1
$ echo "scale='min(250,iw)':-1"
scale='min(250,iw)':-1

Thanks.