15#include <linux/cdrom.h>
20#include <zypp-core/base/LogControl.h>
21#include <zypp-core/ExternalProgram.h>
28#define EJECT_TOOL_PATH "/bin/eject"
35 int fd = ::open( device_r.c_str(), O_RDONLY|O_NONBLOCK|O_CLOEXEC );
40 res = ::ioctl( fd, CDROMEJECT );
48 WAR <<
"Unable to open '" << device_r
49 <<
"' (" << ::strerror( errno ) <<
")" << std::endl;
53 WAR <<
"Eject " << device_r
54 <<
" failed (" << ::strerror( errno ) <<
")" << std::endl;
57#if defined(EJECT_TOOL_PATH)
58 DBG <<
"Try to eject " << device_r <<
" using "
63 cmd[1] = device_r.c_str();
73 if(eject.
close() != 0)
75 WAR <<
"Eject of " << device_r <<
" failed." << std::endl;
82 MIL <<
"Eject of " << device_r <<
" successful." << std::endl;
88 int fd = ::open( device_r.c_str(), O_RDONLY|O_NONBLOCK|O_CLOEXEC );
90 WAR <<
"Unable to open '" << device_r <<
"' (" << ::strerror( errno ) <<
")" << std::endl;
93 int res = ::ioctl( fd, CDROMCLOSETRAY );
96 WAR <<
"Close tray " << device_r <<
" failed (" << ::strerror( errno ) <<
")" << std::endl;
99 DBG <<
"Close tray " << device_r << std::endl;
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
int close()
Wait for the progamm to complete.
std::string receiveLine()
Read one line from the input stream.