MCPcopy Create free account
hub / github.com/audacity/audacity / output_reset

Function output_reset

lib-src/sqlite/shell.c:15487–15522  ·  view source on GitHub ↗

** Change the output file back to stdout. ** ** If the p->doXdgOpen flag is set, that means the output was being ** redirected to a temporary file named by p->zTempFile. In that case, ** launch start/open/xdg-open on that temporary file. */

Source from the content-addressed store, hash-verified

15485** launch start/open/xdg-open on that temporary file.
15486*/
15487static void output_reset(ShellState *p){
15488 if( p->outfile[0]=='|' ){
15489#ifndef SQLITE_OMIT_POPEN
15490 pclose(p->out);
15491#endif
15492 }else{
15493 output_file_close(p->out);
15494#ifndef SQLITE_NOHAVE_SYSTEM
15495 if( p->doXdgOpen ){
15496 const char *zXdgOpenCmd =
15497#if defined(_WIN32)
15498 "start";
15499#elif defined(__APPLE__)
15500 "open";
15501#else
15502 "xdg-open";
15503#endif
15504 char *zCmd;
15505 zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile);
15506 if( system(zCmd) ){
15507 utf8_printf(stderr, "Failed: [%s]\n", zCmd);
15508 }else{
15509 /* Give the start/open/xdg-open command some time to get
15510 ** going before we continue, and potential delete the
15511 ** p->zTempFile data file out from under it */
15512 sqlite3_sleep(2000);
15513 }
15514 sqlite3_free(zCmd);
15515 outputModePop(p);
15516 p->doXdgOpen = 0;
15517 }
15518#endif /* !defined(SQLITE_NOHAVE_SYSTEM) */
15519 }
15520 p->outfile[0] = 0;
15521 p->out = stdout;
15522}
15523
15524/*
15525** Run an SQL command and return the single integer result.

Callers 3

do_meta_commandFunction · 0.85
process_inputFunction · 0.85
wmainFunction · 0.85

Calls 3

output_file_closeFunction · 0.85
utf8_printfFunction · 0.85
outputModePopFunction · 0.85

Tested by

no test coverage detected