在 Ubuntu 下使用 "sh" 打开可执行文件

Open a executable with "sh" under Ubuntu

我正在为 Sonar (http://javadocs.sonarsource.org/4.5/apidocs/org/sonar/api/utils/command/Command.html) 使用 API,它表示函数执行 "the command will be executed with sh executable."
的命令 我想做的就是使用

tslint path/to/my/code.ts

在终端中(因为这个有效)。但是该死的方法执行了带有 "sh" 的行,所以它看起来像这样

sh tslint path/to/my/code.ts

并给我错误

sh: 0: can't open tslint

即使命令以 sh 开头,我如何解决这个问题以仅执行 "tslint"?

感谢您的帮助

编辑:由于你们中的许多人询问生成此命令的 java 代码是什么样的(不是我的,它来自一个开源项目):

Command command = Command.create("tslint");  
command.addArgument("--config " + configFile + " --format json " + file.trim()); 

最终编辑:
工作版本:

Command command = Command.create("node");  
        command.addArgument(pathToTsLint);  
        command.addArgument("--format");  
        command.addArgument("json");  
        command.addArgument("--config");  
        command.addArgument(configFile);  
        command.addArgument(file.trim());  
        command.setNewShell(false);

在终端中检查 which tslint 文件的完整路径。 从终端你可以用

/bin/sh -c "/path/to/tslint /path/to/my/code.ts"

使用声纳 API 是:

Command command = Comman.create('/full/path/name/to/tslint');
command.addArgument("--config " + configFile + " --format json " + file.trim()); 

您不需要 sh 命令中的 -c 参数,但您必须使用 tslint 命令的绝对路径。