在我的gulpfile.js
我有spawn()
这会触发mysqldump
:
let mysqldump = spawn('mysqldump', [
'-v',
'-u',
'my_db_name',
'--password=' + process.env.MY_PRODUCTION_PASSWORD,
'-h',
'my_domain.com',
'my_db_name',
'< ' + dump_filename
], {
stdio: 'inherit'
});
虽然我收到有关最后一部分的错误消息。它说Couldn't find table: "< Development-dump.sql"
让我相信最后一行没有使用转储文件作为输入。如何让spawn
将文件用作这样的输入?
答案 0 :(得分:0)
发生错误是因为spawn
命令无法解析输入。您需要将转储文件写入input
命令的spawn
流:
// Define the spawned process without the input
let mysqldump = spawn('mysqldump', [
'-v',
'-u',
'my_db_name',
'--password=' + process.env.MY_PRODUCTION_PASSWORD,
'-h',
'my_domain.com',
'my_db_name'
]);
// Write the dump file to the input stream.
mysqldump.stdin.write(//path to dump file);
mysqldump.stdin.end();
答案 1 :(得分:0)
您似乎想使用var CLIENT_ID = 'MY CLIENT_ID GOES HERE';
var SCOPES = ["https://www.googleapis.com/auth/calendar"];
checkAuth();
function checkAuth() {
gapi.auth.authorize(
{
'client_id': CLIENT_ID,
'scope': SCOPES.join(' '),
'immediate': true
}, handleAuthResult);
}
function handleAuthResult(authResult) {
if (authResult && !authResult.error) {
console.log(authResult);
loadCalendarApi();
} else {
gapi.auth.authorize(
{client_id: CLIENT_ID, scope: SCOPES, immediate: false},
handleAuthResult);
return false;
}
}
function loadCalendarApi() {
gapi.client.load('calendar', 'v3', createEvent);
}
function createEvent(){
var resource = {
"summary": eventName,
"location": location,
"description": rid,
"start": {
"dateTime": startNew
},
"end": {
"dateTime": endNew
},
};
var request = gapi.client.calendar.events.insert({
'calendarId': 'MY CALENDAR ID GOES HERE@group.calendar.google.com',
'resource': resource
});
request.execute(function(resp) {
console.log(resp);
callback();
});
}
重定向标准输入,以下代码可能有效。
<