问题描述
我无法使用child_process
运行脚本。相同的命令适用于Terminal或在其前面添加sudo
时使用。我不希望添加sudo
,因为它希望它自动运行。下面是我的代码:
var cmd_saga = 'grid_spline 4 ' +
'-TARGET_DEFinitioN 0 -SHAPES "' + shapefile + '" -FIELD "' + short_param + '" -METHOD 1 ' +
'-EPSILON 0.0001 -LEVEL_MAX 14 -TARGET_USER_SIZE 0.01 -TARGET_USER_FITS 1 ' +
'-TARGET_OUT_GRID "' + saga_path + '"';
const { spawnSync } = require( 'child_process' );
const sag = spawnSync('saga_cmd',cmd_saga.split(' '));
console.log( `stderr: ${sag.stderr.toString()}` );
console.log( `stdout: ${sag.stdout.toString()}` );
下面是我在没有sudo
的情况下运行它的错误消息:
stderr: Error: input file [/home/user/apps/app/temp/ApDy5Icw0anTkX7-AAAD/1599095530195.shp]
Error: Points
stdout: ____________________________
##### ## ##### ##
### ### ## ###
### # ## ## #### # ##
### ##### ## # #####
##### # ## ##### # ##
____________________________
SAGA Version: 2.3.1
____________________________
library path: /usr/lib/x86_64-linux-gnu/saga/
library name: libgrid_spline
library : Spline Interpolation
tool : Multilevel B-Spline Interpolation
author : O.Conrad (c) 2006
processors : 24 [24]
____________________________
Load shapes: /home/user/apps/app/temp/ApDy5Icw0anTkX7-AAAD/1599095530195.shp...
Failed
Usage: saga_cmd grid_spline 4 [-SHAPES <str>] [-FIELD <str>] [-TARGET_DEFinitioN <str>] [-TARGET_USER_SIZE <double>] [-TARGET_USER_XMIN <double>] [-TARGET_USER_XMAX <double>] [-TARGET_USER_YMIN <double>] [-TARGET_USER_YMAX <double>] [-TARGET_USER_FITS <str>] [-TARGET_TEMPLATE <str>] [-TARGET_OUT_GRID <str>] [-METHOD <str>] [-EPSILON <double>] [-LEVEL_MAX <num>]
-SHAPES:<str> Points
Shapes (input)
-FIELD:<str> Attribute
Table field
-TARGET_DEFinitioN:<str> Target Grid System
Choice
Available Choices:
[0] user defined
[1] grid or grid system
Default: 0
-TARGET_USER_SIZE:<double> Cellsize
Floating point
Minimum: 0.000000
Default: 1.000000
-TARGET_USER_XMIN:<double> Left
Floating point
Default: 0.000000
-TARGET_USER_XMAX:<double> Right
Floating point
Default: 100.000000
-TARGET_USER_YMIN:<double> Bottom
Floating point
Default: 0.000000
-TARGET_USER_YMAX:<double> Top
Floating point
Default: 100.000000
-TARGET_USER_FITS:<str> Fit
Choice
Available Choices:
[0] nodes
[1] cells
Default: 0
-TARGET_TEMPLATE:<str> Target System
Grid (optional input)
-TARGET_OUT_GRID:<str> Target Grid
Grid (output)
-METHOD:<str> Method
Choice
Available Choices:
[0] without B-spline refinement
[1] with B-spline refinement
Default: 1
-EPSILON:<double> Threshold Error
Floating point
Minimum: 0.000000
Default: 0.000100
-LEVEL_MAX:<num> Maximum Level
Integer
Minimum: 1
Maximum: 14
Default: 11
grid_spline 4 -TARGET_DEFinitioN 0 -SHAPES "/home/user/apps/app/temp/ApDy5Icw0anTkX7-AAAD/1599095530195.shp" -FIELD "chlorophyl" -METHOD 1 -EPSILON 0.0001 -LEVEL_MAX 14 -TARGET_USER_SIZE 0.01 -TARGET_USER_FITS 1 -TARGET_OUT_GRID "/home/user/apps/app/temp/ApDy5Icw0anTkX7-AAAD/1599095530195.sdat"
我还使用sudo chmod 755
和chmod +x *
将文件夹和文件制成了可执行文件
有什么方法可以使它在没有sudo
的情况下运行?我愿意使用其他任何可用的库。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)