void AfterEffectsBurner::startProcess() { LOG_5( "AEB::startBurn() starting" ); QString cmd = executable(); QStringList args = buildCmdArgs(); mCmd = new QProcess( this ); connectProcess( mCmd ); QString outputDir = Path( mJob.outputPath() ).dirPath(); if( !QFile::exists( outputDir ) ) { logMessage( "creating output dir: "+ outputDir ); QDir(outputDir).mkpath( outputDir ); QFile::setPermissions( outputDir, QFile::ReadUser|QFile::WriteUser|QFile::ExeUser|QFile::ReadGroup|QFile::WriteGroup|QFile::ExeGroup|QFile::ReadOther|QFile::WriteOther|QFile::ExeOther ); } logMessage( "AEB: Starting Cmd: " + cmd + " " + args.join(" ") ); #ifdef Q_OS_WIN mCmd->start( cmd, args ); mJobAssignment.setCommand(cmd + " " + args.join(" ")); #else cmd = cmd + " " + args.join(" ") + "\""; mCmd->start( cmd ); mJobAssignment.setCommand( cmd ); #endif mCheckupTimer->start( 15 * 1000 ); taskStart( mFrame ); }
bool CPDetectorDialog::ShowFileDialog(wxString & prog) { wxFileName executable(prog); #ifdef MAC_SELF_CONTAINED_BUNDLE wxString autopanoPath = MacGetPathToUserAppSupportAutoPanoFolder(); #endif wxFileDialog dlg(this,_("Select control point detector program"), #ifdef MAC_SELF_CONTAINED_BUNDLE autopanoPath, #else executable.GetPath(), #endif executable.GetFullName(), #ifdef __WXMSW__ _("Executables (*.exe,*.vbs,*.cmd, *.bat)|*.exe;*.vbs;*.cmd;*.bat"), #else wxT(""), #endif wxFD_OPEN, wxDefaultPosition); if (dlg.ShowModal() == wxID_OK) { prog=dlg.GetPath(); return true; } else return false; };
void update_call_site(STATE, CallSite* other) { if(this != other) { if(CompiledCode* ccode = try_as<CompiledCode>(executable())) { ccode->machine_code()->store_call_site(state, ccode, ip(), other); } } }
void Application::setDesktopFile(const QString& desktop_file) { QString oldDesktopFile = this->desktop_file(); QByteArray byte_array = desktop_file.toUtf8(); gchar *file = byte_array.data(); if(desktop_file.startsWith("/")) { /* It looks like a full path to a desktop file */ m_appInfo.reset((GAppInfo*)g_desktop_app_info_new_from_filename(file)); } else { /* It might just be a desktop file name; let GIO look for the actual desktop file for us */ /* The docs for g_desktop_app_info_new() says it respects "-" to "/" substitution as per XDG Menu Spec, but it only seems to work for exactly 1 substitution where as Wine programs often require many. Bottom line: We must do some manual trial and error to find desktop files in deeply nested directories. Same workaround is implemented in Unity: plugins/unityshell/src/PlacesView.cpp:731 References: https://bugzilla.gnome.org/show_bug.cgi?id=654566 https://bugs.launchpad.net/unity-2d/+bug/794471 */ int slash_index; do { m_appInfo.reset((GAppInfo*)g_desktop_app_info_new(file)); slash_index = byte_array.indexOf("-"); if (slash_index == -1) { break; } byte_array.replace(slash_index, 1, "/"); file = byte_array.data(); } while (m_appInfo.isNull()); } /* setDesktopFile(…) may be called with the same desktop file, when e.g. the contents of the file have changed. Some properties may have changed. */ QString newDesktopFile = this->desktop_file(); if (newDesktopFile != oldDesktopFile) { Q_EMIT desktopFileChanged(newDesktopFile); } /* Emit the Changed signal on all properties that can depend on m_appInfo m_application's properties take precedence over m_appInfo's */ if (m_appInfo != NULL) { if (m_application == NULL) { Q_EMIT nameChanged(name()); Q_EMIT iconChanged(icon()); } Q_EMIT executableChanged(executable()); } /* Update the list of static shortcuts (quicklist entries defined in the desktop file). */ m_staticShortcuts.reset(indicator_desktop_shortcuts_new(newDesktopFile.toUtf8().constData(), "Unity")); monitorDesktopFile(newDesktopFile); }
ReservedSpace ReservedSpace::last_part(size_t partition_size, size_t alignment) { assert(partition_size <= size(), "partition failed"); ReservedSpace result(base() + partition_size, size() - partition_size, alignment, special(), executable()); return result; }
bool KLpdUnixPrinterImpl::setupCommand(QString &cmd, KPrinter *printer) { QString exe = printer->option("kde-printcommand"); if(exe.isEmpty() || exe == "<automatic>") { exe = executable(); if(!exe.isEmpty()) { cmd = exe; if(exe.right(3) == "lpr") initLprPrint(cmd, printer); else initLpPrint(cmd, printer); return true; } else printer->setErrorMessage(i18n("No valid print executable was found in your path. Check your installation.")); return false; } else { QMap< QString, QString > map; map.insert("printer", printer->printerName()); map.insert("copies", QString::number(printer->numCopies())); cmd = KMacroExpander::expandMacrosShellQuote(exe, map); return true; } }
static int iscommand(Char *name) { struct varent *v; Char **pv, *sav; int hashval, hashval1, i; int slash; hashval = 0; slash = any(short2str(name), '/'); v = adrof(STRpath); if (v == 0 || v->vec[0] == 0 || slash) pv = justabs; else pv = v->vec; sav = Strspl(STRslash, name); /* / command name for postpending */ if (havhash) hashval = hashname(name); i = 0; do { if (!slash && pv[0][0] == '/' && havhash) { hashval1 = hash(hashval, i); if (!bit(xhash, hashval1)) goto cont; } if (pv[0][0] == 0 || eq(pv[0], STRdot)) { /* don't make ./xxx */ if (executable(NULL, name, 0)) { free(sav); return i + 1; } } else { if (executable(*pv, sav, 0)) { free(sav); return i + 1; } } cont: pv++; i++; } while (*pv); free(sav); return 0; }
void UpdateModule::RunUpdater(QString parameter) { #ifdef Q_WS_WIN QFile executable(updateExecutable); QFile config(updateConfig); if (executable.exists() && config.exists()) QProcess::startDetached(executable.fileName(), QStringList() << parameter); #endif }
ReservedSpace ReservedSpace::first_part(size_t partition_size, size_t alignment, bool split, bool realloc) { assert(partition_size <= size(), "partition failed"); if (split) { os::split_reserved_memory(base(), size(), partition_size, realloc); } ReservedSpace result(base(), partition_size, alignment, special(), executable()); return result; }
bool KLpdPrinterImpl::setupCommand(QString& cmd, KPrinter *printer) { QString exestr = executable(); if (exestr.isEmpty()) { printer->setErrorMessage(i18n("The <b>%1</b> executable could not be found in your path. Check your installation.").arg("lpr")); return false; } cmd = QString::fromLatin1("%1 -P %2 '-#%3'").arg(exestr).arg(quote(printer->printerName())).arg(printer->numCopies()); return true; }
std::string FileSystem::GetExecutablePath() { char ownPth[MAX_PATH]; HMODULE hModule = GetModuleHandle(NULL); if (hModule != NULL) { // When passing NULL to GetModuleHandle, it returns handle of exe itself GetModuleFileName(hModule,ownPth, (sizeof(ownPth))); } std::string executable(ownPth); std::replace(executable.begin(), executable.end(), '\\', '/' ); unsigned found = executable.find_last_of("/\\"); executable = executable.substr(0, found).append("/"); return executable; }
ExternalEditorDialogPrivate::ExternalEditorDialogPrivate() : m_defaultEditor( potlatch ) { QString path = QProcessEnvironment::systemEnvironment().value( "PATH", "/usr/local/bin:/usr/bin:/bin" ); foreach( const QString &application, QStringList() << merkaartor << josm ) { m_installedEditors[application] = false; /** @todo: what's the qt way to get the path entry separator? Will be a semicolon on Windows */ foreach( const QString &dir, path.split( QLatin1Char( ':' ) ) ) { QFileInfo executable( QDir( dir ), application ); if ( executable.exists() ) { m_installedEditors[application] = true; break; } } } }
ExtScript *ExtScript::copy(const QString _fileName, const int _number) { qCDebug(LOG_LIB) << "File" << _fileName << "with number" << _number; ExtScript *item = new ExtScript(static_cast<QWidget *>(parent()), _fileName, directories()); item->setActive(isActive()); item->setApiVersion(apiVersion()); item->setComment(comment()); item->setExecutable(executable()); item->setInterval(interval()); item->setName(name()); item->setNumber(_number); item->setPrefix(prefix()); item->setRedirect(redirect()); return item; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); container = new QX11EmbedContainer(ui->terminal); container->resize(500, 464); process = new QProcess(container); QString executable("xterm"); QStringList arguments; arguments << "-into"; arguments << QString::number(container->winId()); arguments << "./2001Console"; process->start(executable, arguments); }
int customCom(char *args[],int j,char *history[]){ char *exitt="exit"; char *unlem="!"; char *historycommand="history"; int i; if(j==1 && !strcmp(args[0],historycommand) ){ for(i=0;i<=9;i++){ if(strcmp(history[i],"")){ printf("%d) ",i+1); printf("%s\n",history[i]); } } } if(j==1 && !strcmp(args[0],exitt) ){ exit(0); } if(j==2){ printf("aaaaaaaaaaaaaa\n"); if(!strcmp(args[0],unlem) ){ printf("bbbbbbbbbbb\n"); hiscount=atoi(args[1]); printf("ccccccccccc"); if(hiscount > -2 || hiscount <11 ){ if(hiscount==-1){ hiscount=1; } executable(history); printf("11111111"); } } } return 1; }
void LauncherApplication::setSnStartupSequence(SnStartupSequence* sequence) { if (sequence != NULL) { if (!sn_startup_sequence_get_completed(sequence)) { /* 'launching' property becomes true for a few seconds */ m_launching_timer.start(); } else { m_launching_timer.stop(); } sn_startup_sequence_ref(sequence); } m_snStartupSequence.reset(sequence); nameChanged(name()); iconChanged(icon()); executableChanged(executable()); launchingChanged(launching()); }
void InitialConfigDialog::browseEditor() { FNTRACE("", "InitialConfigDialog", "browseEditor", ""); QString executablePath = QFileDialog::getOpenFileName(this, "Select ds1edit executable", editorPath->text(), "Executable Files (*.exe);;All Files (*.*)"); if (executablePath.length()) { QFileInfo executable(executablePath); assert(executable.exists()); editorPath->setText(executable.absolutePath()); editorName->setText(executable.fileName()); } if (!editorPath->text().isEmpty() && !editorName->text().isEmpty()) { buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); } }
QString LinuxDeviceProcess::fullCommandLine() const { QString fullCommandLine; foreach (const QString &filePath, rcFilesToSource()) fullCommandLine += QString::fromLatin1("test -f %1 && source %1;").arg(filePath); if (!m_workingDir.isEmpty()) { fullCommandLine.append(QLatin1String("cd ")).append(quote(m_workingDir)) .append(QLatin1String(" && ")); } const QString envString = environment().toStringList().join(QLatin1String(" ")); if (!envString.isEmpty()) fullCommandLine.append(QLatin1Char(' ')).append(envString); if (!fullCommandLine.isEmpty()) fullCommandLine += QLatin1Char(' '); fullCommandLine.append(quote(executable())); if (!arguments().isEmpty()) { fullCommandLine.append(QLatin1Char(' ')); fullCommandLine.append(Utils::QtcProcess::joinArgsUnix(arguments())); } return fullCommandLine; }
void applicationdir(char *dir,size_t l) { #ifdef USE_LINUX executable(dir,l); char *p = strrchr(dir,'/'); if(p) *p = '\0'; #endif #ifdef USE_WIN32 #ifdef USE_WCHAR wchar_t wdir[l]; GetModuleFileName(NULL,wdir,l); w2char(dir,wdir,l); #else GetModuleFileName(NULL,dir,l); #endif char *p = strrchr(dir,'\\'); if(!p) p = strrchr(dir,'/'); if(p) *p = '\0'; //#else // strcpy(dir,"."); #endif }
QString QnxDeviceProcess::fullCommandLine() const { QStringList args = arguments(); args.prepend(executable()); QString cmd = QtcProcess::Arguments::createUnixArgs(args).toString(); QString fullCommandLine = QLatin1String( "test -f /etc/profile && . /etc/profile ; " "test -f $HOME/profile && . $HOME/profile ; " ); if (!m_workingDir.isEmpty()) fullCommandLine += QString::fromLatin1("cd %1 ; ").arg(QtcProcess::quoteArg(m_workingDir)); for (auto it = environment().constBegin(); it != environment().constEnd(); ++it) fullCommandLine += QString::fromLatin1("%1='%2' ").arg(it.key()).arg(it.value()); fullCommandLine += QString::fromLatin1("%1 & echo $! > %2").arg(cmd).arg(m_pidFile); return fullCommandLine; }
static int install_package(const char *slug) { int rc; clib_package_t *pkg = clib_package_new_from_slug(slug, opts.verbose); if (NULL == pkg) return -1; if (pkg->install) { rc = executable(pkg); goto done; } rc = clib_package_install(pkg, opts.dir, opts.verbose); if (0 == rc && opts.dev) { rc = clib_package_install_development(pkg, opts.dir, opts.verbose); } done: clib_package_free(pkg); return rc; }
//! [0] int main(int argc, char *argv[]) { QApplication app(argc, argv); if (app.arguments().count() != 2) { qFatal("Error - expected executable path as argument"); return 1; } QX11EmbedContainer container; container.show(); QProcess process(&container); QString executable(app.arguments()[1]); QStringList arguments; arguments << QString::number(container.winId()); process.start(executable, arguments); int status = app.exec(); process.close(); return status; }
void ToolInstance::onRun() { QScrollBar* scrollbar = m_ui.edtOutput->verticalScrollBar(); bool end = scrollbar->value() == scrollbar->maximum(); int oldValue = scrollbar->value(); m_ui.edtOutput->setTextColor(Qt::gray); m_ui.edtOutput->setPlainText(m_ui.edtOutput->toPlainText()); if (end) { scrollbar->setValue(scrollbar->maximum()); } else { scrollbar->setValue(oldValue); } QString exec = executable(); if (exec.contains(" ")) { exec = QString("\"%1\"").arg(exec); } exec.append(" ").append(arguments()); m_process.start(exec, QIODevice::ReadOnly); if (m_process.waitForStarted(1000)) { mCRL2log(mcrl2::log::info) << "Started " << exec.toStdString() << std::endl; m_ui.tabWidget->setCurrentIndex(1); } else { mCRL2log(mcrl2::log::error) << m_process.errorString().toStdString() << " (" << exec.toStdString() << ")" << std::endl; onStateChange(QProcess::NotRunning); } }
void DBusBackendWrapper::launch() { Q_D(DBusBackendWrapper); if (identifier().isEmpty()) { setLastError("No identifier was set"); setStatus(Invalid); return; } QByteArray object = QCryptographicHash::hash(identifier().toLocal8Bit(), QCryptographicHash::Md5); QString dbusIdentifier = QString::fromLocal8Bit(object.toHex()); // Register to DBus d->dbusObjectPath = DBUS_BACKEND_PATH_PREFIX; d->dbusObjectPath.append(dbusIdentifier); new Pt2Adaptor(this); if (!QDBusConnection::sessionBus().registerObject(d->dbusObjectPath, this)) { setLastError(QString("Failed to register object on path %1").arg(d->dbusObjectPath)); setStatus(Invalid); return; } // Launch the backend setStatus(Launching); d->process->setWorkingDirectory(APPLICATION_FOLDER); QString trueExecutable = executable(); trueExecutable.replace("$PROVIDER", QString(PROVIDER_PATH) + " --plugin "); trueExecutable.append(QString(" --identifier %1 ").arg(dbusIdentifier)); debug("dbus-backend-wrapper") << "starting" << trueExecutable; d->process->start(trueExecutable); }
bool WineApplication::isInvalid() const { return executable().isEmpty() or wineConfiguration().isInvalid(); }
bool KModuleListEntry::execute(QWidget *parent) { if (exec.isEmpty()) return FALSE; if (isDirectory()) return FALSE; swallowParent = parent; if (!process) { // Create process object process = new KProcess(); if (!process) return FALSE; // split Exec entry QString executable(exec.data()); QString params; int pos = executable.find(' '); if (pos > 0) { params = executable.right(executable.length()-pos-1); executable.truncate(pos); } // set executable process->setExecutable(executable); // swallowing? then move out of screen, set unique title if (isSwallow()) { *process << "-swallow" << swallowTitle; // *process << "-geometry" << "480x480+10000+10000"; // Avoid flickering a la kwm! (ettrich) KWM::doNotManage(swallowTitle); // connect to KWM events to get notification if window appears connect(kapp, SIGNAL(windowAdd(Window)), this, SLOT(addWindow(Window))); } // set additional parameters // // Note: KProcess does not parse the arguments, so we have to // do it. This should be integrated into KProcess, and also // should be extended to escapes etc. // QString par; while (params.length()>0) { if (params[0]==' ') { if (!par.isEmpty()) *process << par; par = ""; } else { if (params[0]=='"') { params.remove(0,1); while (!params.isEmpty() && params[0] != '"') { par += params[0]; params.remove(0,1); } } else { par += params[0]; } } params.remove(0,1); } if (!par.isEmpty()) *process << par; QObject::connect(process, SIGNAL(processExited(KProcess *)), this, SLOT(processExit(KProcess *))); // start process process->start(); }
int compiler_main(int argc, char* argv[]) { init_colors(); init_symbols(syms); po::options_description common("common options"); common.add_options() ("help", "print help message") ("version", "print version message") ("input,i", po::value<String_seq>(), "specify build inputs") ("output,o", po::value<String>(), "specify the build output file") ("keep,k", "keep temporary files"); // FIXME: These really define the compilation mode. // Here are some rules: // // -s implies -c // -c implies no linking // // -b [archive|library|program] // po::options_description compiler("compile options"); compiler.add_options() ("assemble,s", "compile to native assembly") ("compile,c", "compile but do not link") ("target,t", po::value<String>()->default_value("program"), "produce an archive, module, or program"); po::positional_options_description pos; pos.add("input", -1); po::options_description all; all.add(common) .add(compiler); // Parse command line options. Config conf; po::variables_map vm; try { po::store( po::command_line_parser(argc, argv) .options(all) .positional(pos) .run(), vm); po::notify(vm); } catch(std::exception& err) { std::cerr << "error: " << err.what() << "\n\n"; usage(std::cerr, all); return -1; } // Check for obvious flags first. if (vm.count("help")) { usage(std::cout, all); return 0; } if (vm.count ("version")) { // TODO: Generate the version number from the build. std::cout << "beaker v0.0" << '\n'; return 0; } // Check options. if (vm.count("compile")) conf.compile = true; if (vm.count("assemble")) { conf.assemble = true; conf.compile = true; } if (vm.count("target")) { String t = vm["target"].as<String>(); if (t == "program") { conf.target = program_tgt; } else if (t == "module") { conf.target = module_tgt; } else { std::cerr << "error: invalid build target\n"; usage(std::cerr, all); return -1; } } // Validate the input files. if (!vm.count("input")) { std::cerr << "error: no input files given\n"; usage(std::cerr, all); return -1; } Path_seq inputs; for (String const& s : vm["input"].as<String_seq>()) inputs.push_back(s); // Look for an output file. If not given, assume that // the end result is going to be a native binary. Note // that this is the end goal for inputs of any variety. String output; if (!vm.count("output")) { // TODO: This should depend on the compilation mode. output = "a.out"; } else { output = vm["output"].as<String>(); } // Parse all of the input files into the translation module. // // FIXME: We should collect a set of output files from // parsing since we could potentially pass .ll/.bc/.s/.o // files to the next phase of transdlation. // // FIXME: Clean up temporary files. Path ir = to_ir_file(output); if (!parse(inputs, ir, conf)) return -1; Path as = to_asm_file(output); if (!lower(ir, as, conf)) return -1; if (conf.assemble) return 0; Path obj = to_object_file(output); if (!assemble(as, obj, conf)) return -1; if (conf.compile) return 0; // Generate the linked result. if (conf.target == program_tgt) return executable({obj}, output, conf); if (conf.target == module_tgt) return module({obj}, output, conf); return 0; }
bool PlatformRegion::accessible() const { return readable() || writable() || executable(); }
executable compile() const { return executable( llvm_context, llvm_module ); }
inline PROCESS_INFORMATION win32_start(const Executable &exe, const Arguments &args, const environment &env, stream_info &infoin, stream_info &infoout, stream_info &infoerr, const win32_setup &setup) { file_handle chin, chout, cherr; BOOST_ASSERT(setup.startupinfo->cb >= sizeof(STARTUPINFOA)); BOOST_ASSERT(!(setup.startupinfo->dwFlags & STARTF_USESTDHANDLES)); boost::scoped_ptr<STARTUPINFOA> si(new STARTUPINFOA); ::CopyMemory(si.get(), setup.startupinfo, sizeof(*setup.startupinfo)); si->dwFlags |= STARTF_USESTDHANDLES; switch (infoin.type_) { case stream_info::close: { break; } case stream_info::inherit: { chin = file_handle::win32_std(STD_INPUT_HANDLE, true); break; } case stream_info::use_file: { HANDLE h = ::CreateFileA(infoin.file_.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::win32_start: CreateFile failed")); chin = file_handle(h); break; } case stream_info::use_handle: { chin = infoin.handle_; chin.win32_set_inheritable(true); break; } case stream_info::use_pipe: { infoin.pipe_->rend().win32_set_inheritable(true); chin = infoin.pipe_->rend(); break; } default: { BOOST_ASSERT(false); break; } } si->hStdInput = chin.valid() ? chin.get() : INVALID_HANDLE_VALUE; switch (infoout.type_) { case stream_info::close: { break; } case stream_info::inherit: { chout = file_handle::win32_std(STD_OUTPUT_HANDLE, true); break; } case stream_info::use_file: { HANDLE h = ::CreateFileA(infoout.file_.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::win32_start: CreateFile failed")); chout = file_handle(h); break; } case stream_info::use_handle: { chout = infoout.handle_; chout.win32_set_inheritable(true); break; } case stream_info::use_pipe: { infoout.pipe_->wend().win32_set_inheritable(true); chout = infoout.pipe_->wend(); break; } default: { BOOST_ASSERT(false); break; } } si->hStdOutput = chout.valid() ? chout.get() : INVALID_HANDLE_VALUE; switch (infoerr.type_) { case stream_info::close: { break; } case stream_info::inherit: { cherr = file_handle::win32_std(STD_ERROR_HANDLE, true); break; } case stream_info::redirect: { BOOST_ASSERT(infoerr.desc_to_ == 1); BOOST_ASSERT(chout.valid()); cherr = file_handle::win32_dup(chout.get(), true); break; } case stream_info::use_file: { HANDLE h = ::CreateFileA(infoerr.file_.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (h == INVALID_HANDLE_VALUE) boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::win32_start: CreateFile failed")); cherr = file_handle(h); break; } case stream_info::use_handle: { cherr = infoerr.handle_; cherr.win32_set_inheritable(true); break; } case stream_info::use_pipe: { infoerr.pipe_->wend().win32_set_inheritable(true); cherr = infoerr.pipe_->wend(); break; } default: { BOOST_ASSERT(false); break; } } si->hStdError = cherr.valid() ? cherr.get() : INVALID_HANDLE_VALUE; PROCESS_INFORMATION pi; ::ZeroMemory(&pi, sizeof(pi)); boost::shared_array<char> cmdline = collection_to_win32_cmdline(args); boost::scoped_array<char> executable(new char[exe.size() + 1]); #if defined(__CYGWIN__) ::strcpy(executable.get(), exe.c_str()); #else ::strcpy_s(executable.get(), exe.size() + 1, exe.c_str()); #endif boost::scoped_array<char> workdir(new char[setup.work_directory.size() + 1]); #if defined(__CYGWIN__) ::strcpy(workdir.get(), setup.work_directory.c_str()); #else ::strcpy_s(workdir.get(), setup.work_directory.size() + 1, setup.work_directory.c_str()); #endif boost::shared_array<char> envstrs = environment_to_win32_strings(env); if (!::CreateProcessA(executable.get(), cmdline.get(), NULL, NULL, TRUE, 0, envstrs.get(), workdir.get(), si.get(), &pi)) boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::win32_start: CreateProcess failed")); return pi; }