mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +03:00
0029515: Foundation Classes, OSD - 'Spawn' contains function that isn't available on iOS
Method OSD_Process::Spawn() is removed as useless (not used across OCCT or products). Note that on Linux, macOS, and Windows standard C function "system()" can be used directly instead, while iOS apparently does not support spawning separate processes at all.
This commit is contained in:
parent
0a0eec807d
commit
97e9660965
@ -35,13 +35,6 @@ OSD_Process::OSD_Process(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Standard_Integer OSD_Process::Spawn (const TCollection_AsciiString& cmd,
|
|
||||||
const Standard_Boolean /*ShowWindow*/)
|
|
||||||
{
|
|
||||||
return system(cmd.ToCString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void OSD_Process::TerminalType(TCollection_AsciiString& Name){
|
void OSD_Process::TerminalType(TCollection_AsciiString& Name){
|
||||||
TCollection_AsciiString which="TERM";
|
TCollection_AsciiString which="TERM";
|
||||||
OSD_Environment term (which,"");
|
OSD_Environment term (which,"");
|
||||||
@ -202,48 +195,6 @@ OSD_Process::OSD_Process()
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : Spawn
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Standard_Integer OSD_Process::Spawn (const TCollection_AsciiString& theCmd,
|
|
||||||
const Standard_Boolean theToShowWindow)
|
|
||||||
{
|
|
||||||
#ifndef OCCT_UWP
|
|
||||||
STARTUPINFOW aStartupInfo;
|
|
||||||
ZeroMemory (&aStartupInfo, sizeof(STARTUPINFO));
|
|
||||||
aStartupInfo.cb = sizeof(STARTUPINFO);
|
|
||||||
if (!theToShowWindow)
|
|
||||||
{
|
|
||||||
aStartupInfo.dwFlags = STARTF_USESHOWWINDOW;
|
|
||||||
aStartupInfo.wShowWindow = SW_HIDE;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD aRes = 0;
|
|
||||||
TCollection_ExtendedString aCmdWide (theCmd);
|
|
||||||
wchar_t* aCmdWidePtr = const_cast<wchar_t*>(aCmdWide.ToWideString()); // CreateProcessW() can modify content of this string
|
|
||||||
PROCESS_INFORMATION aProcessInfo;
|
|
||||||
if (!CreateProcessW (NULL, aCmdWidePtr, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &aStartupInfo, &aProcessInfo))
|
|
||||||
{
|
|
||||||
_osd_wnt_set_error (myError, OSD_WProcess);
|
|
||||||
aRes = myError.Error();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CloseHandle (aProcessInfo.hThread);
|
|
||||||
WaitForSingleObject (aProcessInfo.hProcess, INFINITE);
|
|
||||||
GetExitCodeProcess (aProcessInfo.hProcess, &aRes);
|
|
||||||
CloseHandle (aProcessInfo.hProcess);
|
|
||||||
}
|
|
||||||
|
|
||||||
return aRes;
|
|
||||||
#else
|
|
||||||
(void )theCmd;
|
|
||||||
(void )theToShowWindow;
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSD_Process :: TerminalType ( TCollection_AsciiString& Name ) {
|
void OSD_Process :: TerminalType ( TCollection_AsciiString& Name ) {
|
||||||
|
|
||||||
Name = "WIN32 console";
|
Name = "WIN32 console";
|
||||||
|
@ -45,10 +45,6 @@ public:
|
|||||||
//! Initializes the object and prepare for a possible dump
|
//! Initializes the object and prepare for a possible dump
|
||||||
Standard_EXPORT OSD_Process();
|
Standard_EXPORT OSD_Process();
|
||||||
|
|
||||||
//! Issues a shell command
|
|
||||||
//! ShowWindow : flag to allow show/hide of the window ( only used on WNT )
|
|
||||||
Standard_EXPORT Standard_Integer Spawn (const TCollection_AsciiString& cmd, const Standard_Boolean ShowWindow = Standard_True);
|
|
||||||
|
|
||||||
//! Returns the terminal used (vt100, vt200 ,sun-cmd ...)
|
//! Returns the terminal used (vt100, vt200 ,sun-cmd ...)
|
||||||
Standard_EXPORT void TerminalType (TCollection_AsciiString& Name);
|
Standard_EXPORT void TerminalType (TCollection_AsciiString& Name);
|
||||||
|
|
||||||
@ -82,28 +78,8 @@ public:
|
|||||||
//! Returns error number if 'Failed' is TRUE.
|
//! Returns error number if 'Failed' is TRUE.
|
||||||
Standard_EXPORT Standard_Integer Error() const;
|
Standard_EXPORT Standard_Integer Error() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OSD_Error myError;
|
OSD_Error myError;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _OSD_Process_HeaderFile
|
#endif // _OSD_Process_HeaderFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user