use getcwd rather than doing an exec of pwd

Change-Id: Iae00e9f4e22747aaff99469a0a4965d640103d52
Merge "use getcwd rather than doing an exec of pwd"