UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 564 B
import{spawn}from"node:child_process";function osOpenCommand(e){switch(process.platform){case`darwin`:return{command:`open`,args:[e]};case`win32`:return{command:`cmd`,args:[`/c`,`start`,``,e]};default:return{command:`xdg-open`,args:[e]}}}function parseWebUrl(e){let t=URL.parse(e.trim());if(t&&(t.protocol===`http:`||t.protocol===`https:`))return t.href}function openUrl(t){if(parseWebUrl(t)===void 0)return;let{command:n,args:r}=osOpenCommand(t);try{let t=spawn(n,r,{stdio:`ignore`,detached:!0});t.on(`error`,()=>{}),t.unref()}catch{}}export{openUrl,parseWebUrl};