@aivec/wp-docker-dev-factory
Version:
Spin up local WordPress environments with Docker.
17 lines (15 loc) • 389 B
text/typescript
import { execSync } from 'child_process';
export const isRunning = (container: string): boolean => {
try {
const res = execSync(`docker inspect -f '{{.State.Status}}' ${container}`, { stdio: 'pipe' })
.toString()
.trim()
.replace(/^\'|\'$/g, '');
if (res === 'running') {
return true;
}
return false;
} catch (error) {
return false;
}
};