File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
packages/mongodb-memory-server-core/src/util/getos Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -62,5 +62,28 @@ UBUNTU_CODENAME=focal`;
6262 id_like : 'ubuntu' ,
6363 } ) ;
6464 } ) ;
65+
66+ it ( 'should parse an full os-release file with quotes' , ( ) => {
67+ const example = `NAME="Linux Mint"
68+ VERSION="20.2 (Uma)"
69+ ID="linuxmint"
70+ ID_LIKE="ubuntu"
71+ PRETTY_NAME="Linux Mint 20.2"
72+ VERSION_ID="20.2"
73+ HOME_URL="https://www.linuxmint.com/"
74+ SUPPORT_URL="https://forums.linuxmint.com/"
75+ BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
76+ PRIVACY_POLICY_URL="https://www.linuxmint.com/"
77+ VERSION_CODENAME=uma
78+ UBUNTU_CODENAME=focal` ;
79+
80+ expect ( getos . parseOS ( example ) ) . toEqual < getos . LinuxOS > ( {
81+ os : 'linux' ,
82+ dist : 'linuxmint' ,
83+ release : '20.2' ,
84+ codename : 'uma' ,
85+ id_like : 'ubuntu' ,
86+ } ) ;
87+ } ) ;
6588 } ) ;
6689} ) ;
Original file line number Diff line number Diff line change @@ -14,10 +14,10 @@ const LSBRegex = {
1414
1515/** Collection of Regexes for "/etc/os-release" parsing */
1616const OSRegex = {
17- name : / ^ i d \s * = \s * " ? ( . * ) " ? $ / im,
17+ name : / ^ i d \s * = \s * " ? ( \w * ) " ? $ / im,
1818 codename : / ^ v e r s i o n _ c o d e n a m e \s * = \s * ( .* ) $ / im,
1919 release : / ^ v e r s i o n _ i d \s * = \s * " ? ( \d * (?: \. \d * ) ? ) " ? $ / im,
20- id_like : / ^ i d _ l i k e \s * = \s * " ? ( . * ) " ? $ / im,
20+ id_like : / ^ i d _ l i k e \s * = \s * " ? ( \w * ) " ? $ / im,
2121} ;
2222
2323export interface OtherOS {
You can’t perform that action at this time.
0 commit comments