mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-20 18:21:40 +00:00
started testing the use of spawn instead of exec...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
aff4bd455a
commit
69420f1710
@ -118,6 +118,7 @@ if(window.CEF_dumpJSON != null){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
USE_EXEC = false
|
||||||
// XXX this uses vips...
|
// XXX this uses vips...
|
||||||
window.getVipsField = function(field, source){
|
window.getVipsField = function(field, source){
|
||||||
if(source in IMAGES){
|
if(source in IMAGES){
|
||||||
@ -125,12 +126,30 @@ if(window.CEF_dumpJSON != null){
|
|||||||
var source = normalizePath(img.path)
|
var source = normalizePath(img.path)
|
||||||
}
|
}
|
||||||
var getter = $.Deferred()
|
var getter = $.Deferred()
|
||||||
|
|
||||||
|
// exec...
|
||||||
|
if(USE_EXEC){
|
||||||
var cmd = 'vips im_header_string "$FIELD" "$IN"'
|
var cmd = 'vips im_header_string "$FIELD" "$IN"'
|
||||||
.replace(/\$IN/g, osPath(source))
|
.replace(/\$IN/g, osPath(source))
|
||||||
.replace(/\$FIELD/g, field)
|
.replace(/\$FIELD/g, field)
|
||||||
proc.exec(cmd, function(error, stdout, stderr){
|
proc.exec(cmd, function(error, stdout, stderr){
|
||||||
getter.resolve(stdout.trim())
|
getter.resolve(stdout.trim())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// spawn...
|
||||||
|
// NOTE: this should have significantly less overhead than running a shell...
|
||||||
|
} else {
|
||||||
|
var p = proc.spawn('vips', ['im_header_string', field, osPath(source)])
|
||||||
|
p.stdout.on('data', function(data){
|
||||||
|
getter.resolve(data.toString().trim())
|
||||||
|
})
|
||||||
|
/*
|
||||||
|
p.on('close', function(code){
|
||||||
|
getter.resolve(code)
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
return getter
|
return getter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user